package org.example.system.controller;

import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.example.system.entity.OperateLog;
import org.example.system.entity.Unit;
import org.example.system.service.OperateLogService;
import org.example.system.service.UnitService;
import org.example.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * 单元控制层
 */
@RestController
@RequestMapping("/app/unit")
@Slf4j
public class UnitController {

    @Autowired
    private UnitService unitService;
    /**
     * 按条件分页查询
     * @param unit
     * @return
     */
    @GetMapping("/list")
    public R list(Unit unit){
        IPage<Unit> page = unitService.selectPage(unit);
        log.info("------------ UnitController | list | selectPage | return : {} ", JSON.toJSONString(page));
        return R.ok(page);
    }
}
